package best.driver.android.View;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import best.driver.android.R;

public class OrderCancelDialog {
    final Context context;
    public Dialog ad;
    TextView mTvHint;
    Button mBtnConfirm;
    LinearLayout mLlCancelPhone;

    public OrderCancelDialog(final Context context, String hint) {

        this.context = context;
        ad = new Dialog(context, R.style.dialog);
        //ad.requestWindowFeature(Window.FEATURE_NO_TITLE);
        ad.show();
        ad.setCancelable(true);
        //替换对话框窗口的布局
        Window window = ad.getWindow();
        window.setContentView(R.layout.dialog_cancel_order);
        mLlCancelPhone = (LinearLayout) window.findViewById(R.id.ll_cancel_phone);
        setCancelOut();
        mLlCancelPhone.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:4008569900"));
                context.startActivity(intent);
            }
        });
    }

    public void dismiss() {
        ad.dismiss();
    }

    public void setCancelNotClicked() {
        ad.setCanceledOnTouchOutside(false);
    }

    public void setCancelOut() {
        ad.setCanceledOnTouchOutside(true);
    }
}
